﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Evaluant.PS4VS.Language.Reflection
{
    public abstract class Parameter
    {
        public Parameter(string name, int position, bool isRequired, string description)
        {
            Name = name;
            Position = position;
            IsRequired = isRequired;
            Description = description;
        }

        public string Name { get; protected set; }
        public string Description { get; set; }
        public int Position { get; protected set; }
        public bool IsRequired { get; protected set; }

        public bool IsNamed { get { return Position == -1; } }

        public static Parameter CreateParameter(string name, string position, string required, string description)
        {
            if (position == "named")
                return new NamedParameter(name, bool.Parse(required), description);
            else
                return new PositionnedParameter(name, int.Parse(position), bool.Parse(required), description);
        }
    }
}
